package com.oe.impl;

import com.oe.dao.ResumeDao;
import com.oe.pojo.Resume;
import com.oe.pojo.ResumePojo;
import com.oe.service.IResumeService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Component
public class ResumeServiceImpl implements IResumeService {

    @Autowired
    ResumeDao resumeDao;

    @Override
    public List<ResumePojo> queryAll() {
        List<ResumePojo> ret = new ArrayList<>();
        List<Resume> all = resumeDao.findAll();
        if(!CollectionUtils.isEmpty(all)){
            for (Resume resume : all) {
                ResumePojo resumePojo = new ResumePojo();
                BeanUtils.copyProperties(resume,resumePojo);
                ret.add(resumePojo);
            }

        }
        return ret;
    }

    @Override
    public void insertOrUpdate(ResumePojo pojo) {

    }
}
